package com.smart.seckilldemo.controller;


import com.smart.seckilldemo.commons.result.ResponseResult;
import com.smart.seckilldemo.pojo.User;
import com.smart.seckilldemo.rocketmq.producer.RocketMQProducer;
import com.smart.seckilldemo.service.UserService;
import com.smart.seckilldemo.commons.vo.LoginVo;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@RequestMapping("/user")
public class UserController {

    @Resource
    UserService userService;
    @Resource
    RocketMQProducer rocketMQProducer;
    @Resource
    RedisTemplate redisTemplate;

    /**
     * 去注册
     * @return
     */
    @RequestMapping("/toregister")
    public String register(){
        return "register";
    }

    /**
     * 用户注册
     * @param loginVo
     * @return
     */
    @RequestMapping("/register")
    public ResponseResult responseResult(LoginVo loginVo){
        ResponseResult result = userService.registerUser(loginVo);
        return  result;
    }

    /**
     * 用户信息 （测试）
     * @param user
     * @return
     */
    @RequestMapping("/info")
    public ResponseResult info(User user){
        return ResponseResult.success(user);
    }



}
